package com.example.administrator.School.until;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;

import com.example.administrator.School.R;

import butterknife.ButterKnife;

/**
 * Created by ChrisWong on 2017/1/17.
 */
public abstract class BaseActivity<T> extends AppCompatActivity {

    protected abstract int getContentView();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        initBundle(getIntent().getExtras());
        setContentView(getContentView());
        //设置背景
//        View view = this.getWindow().getDecorView();   //getDecorView 获得window最顶层的View
//        view.setBackgroundDrawable(this.getResources().getDrawable(R.drawable.bg_index));
        onBindViewBefore();
        ButterKnife.bind(this);
        initWidget();
        initData();
    }

    protected void onBindViewBefore() {
        // ...
    }

    protected boolean initBundle(Bundle bundle){
        return false;
    }

    protected void initWidget() {

    }

    protected void initData() {

    }

//    @LayoutRes
//    protected abstract int getContentLayoutId();

//    @DrawableRes
//    protected int getLeftIconRes() {
//        return 0;
//    }
//
//    @DrawableRes
//    protected int getRightIconRes() {
//        return 0;
//    }
//
//    protected View.OnClickListener getLeftIconClickListener() {
//        return new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                finish();
//            }
//        };
//    }
//
//    protected View.OnClickListener getRightIconClickListener() {
//        return null;
//    }
}
